package Z.dailyExercise._0224;



public class _剑指Offer25合并两个排序的链表 {
    public ListNode mergeTwoLists(ListNode l1, ListNode l2) {

        ListNode first = new ListNode(0);
        ListNode last = first;
        //first.next= last;

        while (l1 != null && l2 != null){
            if (l1.val<=l2.val){
                last.next =l1;
                l1 = l1.next;
            }else {
                last.next = l2;
                l2 = l2.next;
            }
            last = last.next;
        }

        last.next = l1 == null? l2:l1;

        return first.next;




    }
}
